<?php

namespace wechat;

class WxPayV3Controller
{
    private array $config;

    public function __construct($secret)
    {
        $config = [
            'mch_id' => $secret->mch_id,
            'serial_no' => $secret->serial_no,
            'son_mch_id' => $secret->sub_mch_id,
            'apiclient_cert' => ROOT_PATH . "public" . $secret->cert_path, // 商户证书路径
            'apiclient_key' => ROOT_PATH . "public" . $secret->key_path, // 商户私钥路径
        ];
        $this->config = $config;
    }

    public function createCoupon($param)
    {
        $data = array_merge($this->config,['data'=>$param]);
        $WxPayV3Class = new WxPayV3($data);
        return $WxPayV3Class->createShopCoupon();
    }




}